//
// Buttons
// --------------------------------------------------


// Base styles
// --------------------------------------------------

// Core
.sui-btn {
  display: inline-block;
  padding: @basePadding;
  box-sizing: border-box;
  margin-bottom: 0; // For input.btn
  font-size: @baseFontSize;
  line-height: @baseLineHeight;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  .buttonBackground(@btnBackground, @btnBackgroundHighlight, @grayDark);
  .border-radius(@borderRadiusMini);
  .user-select(none);

  // Hover/focus state
  &:hover,
  &:focus {
    color: @grayDark;
    text-decoration: none;

    // transition is only when going to hover/focus, otherwise the background
    // behind the gradient (there for IE<=9 fallback) gets mismatched
  }

  // Focus state for keyboard and accessibility
  &:focus {
    .tab-focus();
    outline: none;
  }

  // Active state
  &.active,
  &:active {
    background-image: none;
  }

  // Disabled state
  &.disabled,
  &[disabled] {
    cursor: default;
    background-image: none;
    .box-shadow(none);
    .user-select(none);
  }

  .sui-icon {
    line-height: 1;
  }

  .sui-icon:after {
    content: " ";
  }

}



// Button Sizes
// --------------------------------------------------

// Large
.btn-xlarge {
  padding: @paddingXLarge;
  line-height: @lineHeightLarge;
  font-size: @fontSizeLarge;
}

// Large
.btn-large {
  padding: @paddingLarge;
  line-height: @lineHeightLarge;
  font-size: @fontSizeLarge;
}

// Small
.btn-small {
  padding: @paddingSmall;
  line-height: @lineHeightSmall;
  font-size: @fontSizeSmall;
}


// Block button
// -------------------------

.btn-block {
  display: block;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
  .box-sizing(border-box);
}

// Vertically space out multiple block buttons
.btn-block + .btn-block {
  margin-top: 5px;
}

// Specificity overrides
input[type="submit"],
input[type="reset"],
input[type="button"] {
  &.btn-block {
    width: 100%;
  }
}


// Set the backgrounds
// -------------------------
.btn-primary {
  .buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight);
}
// Warning appears are orange
.btn-warning {
  .buttonBackground(@btnWarningBackground, @btnWarningBackgroundHighlight);
}
// Danger and error appear as red
.btn-danger {
  .buttonBackground(@btnDangerBackground, @btnDangerBackgroundHighlight);
}
// Success appears as green
.btn-success {
  .buttonBackground(@btnSuccessBackground, @btnSuccessBackgroundHighlight);
}
// Info appears as a neutral blue
.btn-info {
  .buttonBackground(@btnInfoBackground, @btnInfoBackgroundHighlight);
}
// Inverse appears as dark gray
.btn-inverse {
  .buttonBackground(@btnInverseBackground, @btnInverseBackgroundHighlight);
}


// Cross-browser Jank
// --------------------------------------------------

button.btn,
input[type="submit"].btn {

  // Firefox 3.6 only I believe
  &::-moz-focus-inner {
    padding: 0;
    border: 0;
  }

  // IE7 has some default padding on button controls
  *padding-top: 3px;
  *padding-bottom: 3px;

  &.btn-large {
    *padding-top: 7px;
    *padding-bottom: 7px;
  }
  &.btn-small {
    *padding-top: 3px;
    *padding-bottom: 3px;
  }
  &.btn-mini {
    *padding-top: 1px;
    *padding-bottom: 1px;
  }
}


// Link buttons
// --------------------------------------------------

// Make a button look and behave like a link
.btn-link,
.btn-link:active,
.btn-link[disabled] {
  border-color: transparent;
  background-color: transparent;
  background-image: none;
  .box-shadow(none);
}
.btn-link {
  border-color: transparent;
  cursor: pointer;
  color: @linkColor;
  .border-radius(0);
}
.btn-link:hover,
.btn-link:focus {
  color: @linkHoverColor;
  text-decoration: underline;
  background-color: transparent;
  border-color: transparent;
}
.btn-link[disabled], .btn-link.disabled {
  &, &:hover, &:focus {
    color: @btnDisabledColor;
    text-decoration: none;
    background: none;
    border: none;
  }
}


// bordered btn
.sui-btn {
  &.btn-bordered {
    background-color: transparent;
    .buttonBorderedBackground(#999, #666);
    &.btn-primary {
      .buttonBorderedBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight);
    }
    // Warning appears are orange
    &.btn-warning {
      .buttonBorderedBackground(@btnWarningBackground, @btnWarningBackgroundHighlight);
    }
    // Danger and error appear as red
    &.btn-danger {
      .buttonBorderedBackground(@btnDangerBackground, @btnDangerBackgroundHighlight);
    }
    // Success appears as green
    &.btn-success {
      .buttonBorderedBackground(@btnSuccessBackground, @btnSuccessBackgroundHighlight);
    }
    // Info appears as a neutral blue
    &.btn-info {
      .buttonBorderedBackground(@btnInfoBackground, @btnInfoBackgroundHighlight);
    }
    // Inverse appears as dark gray
    &.btn-inverse {
      .buttonBorderedBackground(@btnInverseBackground, @btnInverseBackgroundHighlight);
    }
    &.disabled, &[disabled] {
      &, &:hover, &:focus {
        border-color: @btnDisabledColor;
        color: @btnDisabledColor;
        background: @btnDisabledBackground;
      }
    }
  }
}
